package bavaria.hightech.banking;

import java.text.DateFormat;
import java.util.Calendar;
import java.util.Timer;
import java.util.TimerTask;

public class Zeitgeber  {
    private static final int PERIOD = 600;
    private static final int DELAY = 2000;
	private int counter;
	
	private void datum() {
		Calendar c = Calendar.getInstance();
		DateFormat df = DateFormat.getDateInstance(DateFormat.LONG);
		DateFormat tf = DateFormat.getTimeInstance();
        c.add(Calendar.DATE,++counter);
        System.out.println(df.format(c.getTime()) + " - " + tf.format(c.getTime()));
    }
	
    private void startTiming() {
        Timer timer = new Timer();
        timer.scheduleAtFixedRate(
            new TimerTask()  {
                public void run()  {
                   Zeitgeber.this.datum();
                }
            },
            DELAY,
            PERIOD);
    }

//    public Calendar getCalendar() {
//    	Calendar c1 = (Calendar) c.clone();
//    	return c1;
//    }
    
    public static void main(String[] args)  {
        new Zeitgeber().startTiming();
//    	System.out.println(getCalendar());
    }
    
   
}